// pages/exchange/week/week.js
const { Util } = require("../../../utils/util");
const wxapi = require("../../../utils/wxapi");
const CryptoJS = require('../../../utils/crypto-js');
const { API_IMAGE_URL, API_SNZO_URL, API_SNZO_FILE_URL } = require("../../../utils/wxapi");
const app = getApp();
Page({
  /**
     * 页面的初始数据
     */
  data: {
    date: null,
    educationOfData: ['研究生', '大学本科', '大学专科', '专科学校', '中等专业学校', '中等技术学校', '技工学校', '高中', '初中', '小学',],
    educationIndex: null,
    projectOfData: [],
    periodOfData: [],
    sortOfData: [],
    exhibitsOfData: [],
    auctionOfData: [],
    specsOfData: ['60cm*80cm', '80cm*60cm', '120cm*80cm', '80cm*120cm', '其他'],
    userInfo: null,
    tabStnumArtPeopleMsg: null,
    activityId: null,
    venueId: null,
    showExhibits: false,
    showAuction: false,
    imgUrl: API_SNZO_FILE_URL,
    showError: false,
    isHandle: false
  },

  /**
   * 获取用户基本信息
   */
  getUserInfo() {
    const allParams = {
      cardNo: app.globalData.userInfo.cardNo,
      timestamp: new Date().getTime()
    };
    const trimParams = Util.trimNulls(allParams);
    const pendSign = { ...trimParams, url: '/card/detail' };
    const sign = Util.jsonSort(pendSign);
    const md5Sign = CryptoJS.MD5(sign);
    const params = { sign: md5Sign, ...trimParams };
    const headers = {
      'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
    };
    wxapi.queryCardInfo(params, headers).then(res => {
      if (res.code === 20000) {
        const userInfo = res.data;
        const tabStnumArtPeopleMsg = {
          name: {
            value: userInfo.nickName,
            showError: false,
            disabled: userInfo.nickName ? true : false,
          },
          gender: {
            value: userInfo.sex,
            showError: false,
            disabled: userInfo.sex ? true : false,
          },
          birthDay: {
            value: userInfo.birthday,
            showError: false,
            disabled: userInfo.birthday ? true : false,
          },
          mostEducation: { value: null, showError: false, },
          country: { value: null, showError: false, },
          nation: { value: null, showError: false, },
          duties: { value: null, showError: false, },
          cardNum: {
            value: userInfo.certificateNo,
            showError: false,
            disabled: userInfo.certificateNo ? true : false,
          },
          phone: {
            value: userInfo.userPhone,
            showError: false,
            disabled: userInfo.userPhone ? true : false,
          },
          email: {
            value: userInfo.email,
            showError: false,
            disabled: userInfo.email ? true : false,
          },
          address: {
            value: `${userInfo.belongProvince}${userInfo.belongProvince === userInfo.belongCity
              ? ''
              : userInfo.belongCity
              }${userInfo.belongArea}${userInfo.addressDetail}`,
            showError: false,
            disabled: userInfo.belongProvince ? true : false,
          },
          unit: { value: null, showError: false, },
          item: { value: null, showError: false, },
          activeId: { value: this.data.activityId, showError: false, },
          venueId: { value: this.data.venueId, showError: false, },
          periodId: { value: null, showError: false, },
          venueName: { value: null, showError: false, disabled: true },
          venueOpeningTime: { value: null, showError: false, disabled: true },
          stk: { value: userInfo.cardNo },
        }
        this.setData({
          tabStnumArtPeopleMsg
        })
        app.globalData.userInfo = userInfo;
        this.getActivityIntro(this.data.activityId);
        this.getProject(this.data.activityId);
        this.getVenueIntro(this.data.venueId);
        this.getPeriod(this.data.venueId);
      } else if (res.code === 20005) {
        wx.showModal({
          title: '提示信息',
          content: res.message,
          confirmText: '登录',
          complete: (res) => {
            app.globalData.userInfo = null;
            app.globalData.token = null;
            wx.removeStorage({
              key: 'userInfo',
            })
            wx.removeStorage({
              key: 'token',
            })
            if (res.cancel) {
              wx.switchTab({
                url: '/pages/index/index',
              })
            }
            if (res.confirm) {
              wx.navigateTo({
                url: '/pages/login/login',
              })
            }
          }
        })
      }
    })
  },

  /**
   * 日期选择
   * @param {*} e 
   */
  bindDateChange: function (e) {
    this.setData({
      date: e.detail.value
    })
  },

  bindEducationChange(e) {
    this.setData({
      educationIndex: e.detail.value
    })
  },

  /**
   * 场次选择
   * @param {*} e 
   */
  periodChange(e) {
    const value = e.detail.value;
    this.data.tabStnumArtPeopleMsg.periodId.value = value;
  },

  /**
   * 选择参加项目
   * @param {*} e 
   */
  projectChange(e) {
    const values = e.detail.value;
    if (values.includes('29')) {
      this.setData({
        showExhibits: true
      })
      if (this.data.exhibitsOfData.length === 0) this.addExhibits();
    } else {
      this.setData({
        showExhibits: false,
        exhibitsOfData: []
      })
    }

    if (values.includes('28')) {
      this.setData({
        showAuction: true
      })
      if (this.data.auctionOfData.length === 0) this.addAuction();
    } else {
      this.setData({
        showAuction: false,
        auctionOfData: []
      })
    }
    this.data.tabStnumArtPeopleMsg.item.value = values.join('|');
  },

  /**
   * 输入名称
   * @param {*} e 
   */
  exhibitsNameChange(e) {
    const exhibitsIndex = e.currentTarget.dataset.exhibitsIndex;
    const exhibitsName = e.detail.value;
    this.data.exhibitsOfData[exhibitsIndex].name = exhibitsName;
    this.setData({
      exhibitsOfData: this.data.exhibitsOfData
    })
  },

  /**
   * 输入名称
   * @param {*} e 
   */
  auctionNameChange(e) {
    const auctionIndex = e.currentTarget.dataset.auctionIndex;
    const auctionName = e.detail.value;
    this.data.auctionOfData[auctionIndex].name = auctionName;
    this.setData({
      auctionOfData: this.data.auctionOfData
    })
  },

  /**
   * 主题选择
   * @param {*} e 
   */
  themeChange(e) {
    const themeType = e.currentTarget.dataset.themeType;
    const themeIndex = e.currentTarget.dataset.themeIndex;
    const values = e.detail.value;
    if (themeType === 'exhibits') {
      this.data.exhibitsOfData[themeIndex].showMajor = values.join('|');
    } else if (themeType === 'auction') {
      this.data.auctionOfData[themeIndex].showMajor = values.join('|');
    }
  },

  /**
   * 线下艺术品规格
   * @param {*} e 
   */
  specsChange(e) {
    const specsIndex = e.currentTarget.dataset.specsIndex;
    const value = e.detail.value;
    this.data.auctionOfData[specsIndex].specs = value;
  },

  standby4Change() { },
  standby3Change() { },

  /**
   * 输入长度
   * @param {*} e 
   */
  longChange(e) {
    const longIndex = e.currentTarget.dataset.acreageIndex;
    const longValue = e.detail.value;
    const regex = /^[1-9]\d*$/;
    if (!longValue) {
      this.data.exhibitsOfData[longIndex].showLong = '';
    } else if (!isNaN(+longValue) && regex.test(longValue.toString())) {
      this.data.exhibitsOfData[longIndex].showLong = longValue;
      if (this.data.exhibitsOfData[longIndex].showWide) {
        this.data.exhibitsOfData[longIndex].showAcreage = this.data.exhibitsOfData[longIndex].showWide * Number(longValue);
        this.setData({
          exhibitsOfData: this.data.exhibitsOfData
        })
      }
    } else {
      this.data.exhibitsOfData[wideIndex].showLong = '';
      this.data.exhibitsOfData[wideIndex].showAcreage = '';
    }
    this.setData({
      exhibitsOfData: this.data.exhibitsOfData
    })
  },

  /**
   * 输入宽度
   * @param {*} e 
   */
  wideChange(e) {
    const wideIndex = e.currentTarget.dataset.acreageIndex;
    const wideValue = e.detail.value;
    const regex = /^[1-9]\d*$/;
    if (!wideValue) {
      this.data.exhibitsOfData[wideIndex].showWide = '';
    } else if (!isNaN(+wideValue) && regex.test(wideValue.toString())) {
      this.data.exhibitsOfData[wideIndex].showWide = wideValue;
      if (this.data.exhibitsOfData[wideIndex].showLong) {
        this.data.exhibitsOfData[wideIndex].showAcreage =
          this.data.exhibitsOfData[wideIndex].showLong * Number(wideValue);
      }
    } else {
      this.data.exhibitsOfData[wideIndex].showWide = '';
      this.data.exhibitsOfData[wideIndex].showAcreage = '';
    }
    this.setData({
      exhibitsOfData: this.data.exhibitsOfData
    })
  },

  /**
   * 拍卖艺术品长
   * @param {*} e 
   */
  auctionLongChange(e) {
    const longValue = e.detail.value;
    const longIndex = e.currentTarget.dataset.acreageIndex;
    const regex = /^[1-9]\d*$/;
    if (!longValue) {
      this.data.auctionOfData[longIndex].showLong = '';
    } else if (!isNaN(+longValue) && regex.test(longValue.toString())) {
      this.data.auctionOfData[longIndex].showLong = longValue;
    } else {
      this.data.auctionOfData[longIndex].longValue = '';
    }
    this.setData({
      auctionOfData: this.data.auctionOfData
    })
  },

  /**
   * 拍卖艺术品宽
   * @param {*} e 
   */
  auctionWideChange(e) {
    const wideIndex = e.currentTarget.dataset.acreageIndex;
    const wideValue = e.detail.value;
    const regex = /^[1-9]\d*$/;
    if (!wideValue) {
      this.data.auctionOfData[wideIndex].showWide = '';
    } else if (!isNaN(+wideValue) && regex.test(wideValue.toString())) {
      this.data.auctionOfData[wideIndex].showWide = wideValue;
    } else {
      this.data.auctionOfData[wideIndex].showWide = '';
    }
    this.setData({
      auctionOfData: this.data.auctionOfData
    })
  },

  /**
   * 上传艺术品
   * @param {*} e 
   */
  uploadWorks(e) {
    const worksIndex = e.currentTarget.dataset.worksIndex;
    const worksType = e.currentTarget.dataset.worksType;
    wx.chooseMedia({
      count: 1,
      mediaType: ['image'],
      success: (res) => {
        const filePath = res.tempFiles[0].tempFilePath;
        const thumbSize = (res.tempFiles[0].size / 1024 / 1024).toFixed(2);
        wx.showLoading({
          title: '上传中...',
        })
        wx.uploadFile({
          filePath,
          name: 'file',
          url: API_SNZO_URL + '/upload/uploadImg',
          success: (result) => {
            wx.hideLoading()
            const uploadResult = JSON.parse(result.data);
            if (uploadResult.status === 200) {
              if (worksType === 'exhibits') {
                this.data.exhibitsOfData[worksIndex].showPath = uploadResult.data;
                this.data.exhibitsOfData[worksIndex].worksStorage = thumbSize;
                this.setData({
                  exhibitsOfData: this.data.exhibitsOfData
                })
              } else if (worksType === 'auction') {
                this.data.auctionOfData[worksIndex].showPath = uploadResult.data;
                this.data.auctionOfData[worksIndex].worksStorage = thumbSize;
                this.setData({
                  auctionOfData: this.data.auctionOfData
                })
              }
            } else {
              wx.showModal({
                title: '提示信息',
                content: result.msg,
                showCancel: false
              })
            }
          },
          fail: (result) => {
            wx.hideLoading()
          }
        })
      }
    })
  },

  /**
   * 上传推广视频
   * @param {*} e 
   */
  uploadVideo(e) {
    const worksIndex = e.currentTarget.dataset.worksIndex;
    const worksType = e.currentTarget.dataset.worksType;
    wx.chooseMedia({
      count: 1,
      mediaType: ['video'],
      success: (res) => {
        const filePath = res.tempFiles[0].tempFilePath;
        wx.showLoading({
          title: '上传中...',
        })
        wx.uploadFile({
          filePath,
          name: 'file',
          url: API_SNZO_URL + '/upload/uploadVideo',
          success: (result) => {
            wx.hideLoading()
            const uploadResult = JSON.parse(result.data);
            if (uploadResult.status === 200) {
              if (worksType === 'exhibits') {
                this.data.exhibitsOfData[worksIndex].standby1 = uploadResult.data;
                this.setData({
                  exhibitsOfData: this.data.exhibitsOfData
                })
              } else if (worksType === 'auction') {
                this.data.auctionOfData[worksIndex].standby1 = uploadResult.data;
                this.setData({
                  auctionOfData: this.data.auctionOfData
                })
              }
            } else {
              wx.hideLoading()
              wx.showModal({
                title: '提示信息',
                content: result.msg,
                showCancel: false
              })
            }
          },
          fail: (result) => {
            wx.hideLoading()
          }
        })
      }
    })
  },

  /**
   * 上传艺术品简介
   * @param {*} e 
   */
  uploadFile(e) {
    const worksIndex = e.currentTarget.dataset.worksIndex;
    const worksType = e.currentTarget.dataset.worksType;
    wx.chooseMessageFile({
      count: 1,
      mediaType: ['file'],
      success: (res) => {
        const fileMsg = res.tempFiles[0];
        wx.showLoading({
          title: '上传中...',
        })
        wx.uploadFile({
          filePath: fileMsg.path,
          name: 'file',
          url: API_SNZO_URL + '/upload/uploadOther',
          success: (result) => {
            wx.hideLoading()
            const uploadResult = JSON.parse(result.data);
            if (uploadResult.status === 200) {
              if (worksType === 'exhibits') {
                this.data.exhibitsOfData[worksIndex].standby2 = uploadResult.data;
                this.data.exhibitsOfData[worksIndex].fileName = fileMsg.name;
                this.setData({
                  exhibitsOfData: this.data.exhibitsOfData
                })
              } else if (worksType === 'auction') {
                this.data.auctionOfData[worksIndex].standby2 = uploadResult.data;
                this.data.auctionOfData[worksIndex].fileName = fileMsg.name;
                this.setData({
                  auctionOfData: this.data.auctionOfData
                })
              }
            } else {
              wx.hideLoading()
              wx.showModal({
                title: '提示信息',
                content: result.msg,
                showCancel: false
              })
            }
          },
          fail: (result) => {
            wx.hideLoading()
          }
        })
      }
    })
  },

  /**
   * 添加控件
   * @param {*} e 
   */
  addControl(e) {
    const itemType = e.currentTarget.dataset.itemType;
    if (itemType === 'exhibits') {
      this.addExhibits()
    } else if (itemType === 'auction') {
      this.addAuction()
    }
  },

  /**
   * 删除控件
   * @param {*} e 
   */
  delControl(e) {
    const itemIndex = e.currentTarget.dataset.itemIndex;
    const itemType = e.currentTarget.dataset.itemType;
    if (itemType === 'exhibits') {
      this.data.exhibitsOfData.splice(itemIndex, 1)
      this.setData({
        exhibitsOfData: this.data.exhibitsOfData
      })
    } else if (itemType === 'auction') {
      this.data.auctionOfData.splice(itemIndex, 1)
      this.setData({
        auctionOfData: this.data.auctionOfData
      })
    }
  },

  getActivityIntro() {
    wxapi.selectArtActiveById({ id: this.data.activityId }).then(res => {
      if (res.status === 200) {
        this.setData({
          activityIntro: res.data
        })
      }
    })
  },


  /**
   * 获取分会场详情
   * @param {*} id 
   */
  getVenueIntro(id) {
    wxapi.selectArtVenueById({ id }).then(res => {
      if (res.status === 200) {
        const tabStnumArtPeopleMsg = this.data.tabStnumArtPeopleMsg;
        tabStnumArtPeopleMsg.venueName.value = res.data.venueName;
        tabStnumArtPeopleMsg.venueOpeningTime.value = res.data.openingTime;
        tabStnumArtPeopleMsg.venueId.value = res.data.id
        this.setData({
          venueIntro: res.data,
          tabStnumArtPeopleMsg
        })
      }
    })
  },

  /**
   * 获取场次
   * @param {*} venueId 
   */
  getPeriod(venueId) {
    wxapi.selectArtPeriodByCondi({ venueId }, { pageNum: 1, pageSize: 999 }).then(res => {
      if (res.status === 200) {
        this.setData({
          periodOfData: res.data.seachList
        })
      }
    })
  },


  /**
   * 获取参加项目
   */
  getProject(belongActiveid) {
    wxapi.getStnumArtItemList({ belongActiveid }).then(res => {
      if (res.status === 200) {
        this.setData({
          projectOfData: res.data
        })
      }
    })
  },

  /**
   * 获取专业
   */
  getWorksType() {
    wxapi.getStNumWorksType({ standby4: 24 }).then(res => {
      if (res.status === 200) {
        const sortOfData = res.data.filter(item => { item.checked = false; return item });
        this.setData({
          sortOfData
        })
      }
    })
  },

  /**
   * 添加列展艺术品
   * @param e
   */
  addExhibits() {
    const control = {
      name: '',
      showMajor: '',
      worksStorage: '',
      showPath: '',
      showLong: '',
      showWide: '',
      standby1: '',
      standby2: '',
      standby3: '',
      standby4: '',
      standby5: 3,
      specs: '',
      priceFee: '',
      showAcreage: '',
      fileName: '',
      relateActiveId: '',
      relatePeriodId: '',
      relateVenueId: '',
    };
    const exhibitsOfData = this.data.exhibitsOfData;
    exhibitsOfData.push(control);
    this.setData({
      exhibitsOfData
    })
  },

  /**
   * 删除列展艺术品
   * @param index
   * @param e
   */
  removeExhibits(index) {
    const exhibitsOfData = this.data.exhibitsOfData;
    exhibitsOfData.splice(index, 1);
    this.setData({
      exhibitsOfData
    })
  },

  /**
   * 添加列展艺术品
   * @param e
   */
  addAuction() {
    const control = {
      name: '',
      showMajor: '',
      worksStorage: '',
      showPath: '',
      showLong: '',
      showWide: '',
      standby1: '',
      standby2: '',
      standby3: '',
      standby4: '',
      standby5: 4,
      specs: '',
      priceFee: '',
      showAcreage: '',
      fileName: '',
      relateActiveId: '',
      relatePeriodId: '',
      relateVenueId: '',
    };
    const auctionOfData = this.data.auctionOfData;
    auctionOfData.push(control);
    this.setData({
      auctionOfData
    })
  },

  /**
   * 删除列展艺术品
   * @param index
   * @param e
   */
  removeAuction(index) {
    const auctionOfData = this.data.auctionOfData;
    auctionOfData.splice(index, 1);
    this.setData({
      auctionOfData
    })
  },

  /**
   * 查看交易会规程
   */
  openRule() {
    wx.downloadFile({
      url: 'https://aa.snzo.cn/assets/files/jyhgc.pdf',
      success: (res) => {
        const filePath = res.tempFilePath;
        wx.openDocument({
          filePath
        })
      }
    })
  },

  /**
   * 提交报名
   * @param {*} e 
   */
  formSubmit(e) {
    if (this.data.isHandle) {
      return;
    }
    this.data.isHandle = true;
    const values = e.detail.value;
    let formValid = true;
    for (const key in values) {
      if (Object.hasOwnProperty.call(values, key)) {
        const item = values[key];
        if (!item || item.length === 0) {
          formValid = false;
          this.data.tabStnumArtPeopleMsg[key].showError = true;
        } else {
          this.data.tabStnumArtPeopleMsg[key].value = values[key];
          this.data.tabStnumArtPeopleMsg[key].showError = false;
        }
      }
    }
    if (formValid) {
      let exhibitsPrice = 0;
      for (const item of this.data.exhibitsOfData) {
        if (item.showPath) {
          if (!item.showLong || !item.showWide) {
            wx.showToast({
              title: '请填写列展面积',
            })
            return;
          } else {
            const worksAcreage = Util.floatp(
              Number(item.showLong) * Number(item.showWide),
              10000
            );
            exhibitsPrice = Util.autoAdd(
              Util.floatMul(worksAcreage, 200).toString(),
              exhibitsPrice.toString()
            );
          }
        }
      }
      wx.showModal({
        title: '提示信息',
        content: '您需要支付报名费280元。',
        confirmText: '支付',
        complete: (res) => {
          if (res.cancel) {
            this.data.isHandle = false
          }
          if (res.confirm) {
            wx.showLoading({
              title: '支付中...',
            })
            const artShowMsgs = this.data.exhibitsOfData.concat(this.data.auctionOfData);
            for (const item of artShowMsgs) {
              item.relateActiveId = this.data.activityId;
              item.relateVenueId = this.data.venueId;
              item.relatePeriodId = this.data.tabStnumArtPeopleMsg.periodId.value;
            }
            const peopleMsg = {
              mostEducation: this.data.educationOfData[this.data.educationIndex],
              item: this.data.tabStnumArtPeopleMsg.item.value,
              activeId: 25,
              venueId: this.data.venueId,
              venueName: this.data.tabStnumArtPeopleMsg.venueName.value,
              venueOpeningTime: this.data.tabStnumArtPeopleMsg.venueOpeningTime.value,
              stk: app.globalData.userInfo.cardNo
            }
            const tabStnumArtPeopleMsg = Object.assign(values, peopleMsg);
            const bodyParams = {
              tabStnumArtPeopleMsg,
              tabStnumArtShowMsgs: artShowMsgs
            }
            this.wxPay(bodyParams)
          }
        }
      })
    } else {
      wx.showToast({
        title: '请填写信息',
        success: () => {
          this.data.isHandle = false
        }
      })
      this.setData({
        tabStnumArtPeopleMsg: this.data.tabStnumArtPeopleMsg
      })
    }
  },

  /**
   * 微信支付
   * @param {*} bodyParams 
   */
  wxPay(bodyParams) {
    const openId = wx.getStorageSync('openId');
    let params = { payType: 'XCX' };
    if (openId) {
      params = Object.assign(params, { openId });
    } else {
      wx.login({
        success: (res) => {
          if (res.code) {
            const jsCode = res.code;
            const headers = {
              'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
            }
            wxapi.getMiniOpenId({ jsCode }, headers).then(res => {
              if (res.code === 20000) {
                if (res.data) {
                  wx.setStorageSync('openId', res.data);
                  params = Object.assign(params, { openId: res.data });
                } else {
                  this.data.isHandle = false;
                  wx.hideLoading()
                  wx.showToast({
                    title: '获取openId失败',
                    icon: 'error'
                  })
                }
              } else {
                this.data.isHandle = false;
                wx.hideLoading();
                wx.showModal({
                  title: '提示信息',
                  content: res.message,
                  showCancel: false
                })
              }
            })
          } else {
            this.data.isHandle = false;
            wx.showToast({
              title: '登录失败',
              icon: 'error',
              success: () => {
                wx.switchTab({
                  url: '/pages/index/index',
                })
              }
            })
          }
        },
      })
    }
    wxapi.wxPayEnrollFee(params, bodyParams).then(res => {
      wx.hideLoading();
      if (res.status === 200) {
        this.wxPayment(res.data);
      } else {
        wx.showModal({
          title: '提示信息',
          content: res.msg,
          showCancel: false
        })
      }
    })
  },

  /**
   * 唤起微信支付
   */
  wxPayment(data) {
    wx.requestPayment({
      nonceStr: data.nonceStr,
      package: data.packageValue,
      paySign: data.paySign,
      signType: data.signType,
      timeStamp: data.timeStamp,
      success: (res) => {
        this.data.isHandle = false;
        wx.showToast({
          title: '支付成功',
          duration: 2000,
          success: () => {
            wx.navigateBack()
          }
        })
      },
      fail: (res) => {
        this.data.isHandle = false;
        this.setData({
          isPaying: false,
          isBargainPaying: false,
          showBargain: false
        })
        if (res.errMsg.indexOf('fail cancel') !== -1) {
          wx.showToast({
            title: '交易取消',
            duration: 2000,
            icon: 'none'
          })
        } else {
          wx.showToast({
            title: '订单数据异常',
            duration: 2000,
            icon: 'error'
          })
        }
      }
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    if (options.activityId && options.venueId) {
      this.setData({
        activityId: options.activityId,
        venueId: options.venueId
      })
      this.getUserInfo();
      this.getWorksType();
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})